package com.zhaopin.file;

import org.apache.commons.io.FileUtils;

import java.io.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author Administrator
 * @create 2019-05-27 15:31
 */
public class ReadAndOut2File {

    public static void main(String[] args) throws IOException {

        File file = new File("e:/data4/ranking.txt");
        List list = FileUtils.readLines(file,"utf-8");
        Set set = new HashSet<String>();
        for (Object o : list) {
            set.add(o.toString());
        }
        File file1 = new File("e:/data4/rankingnew.txt");
        PrintWriter printWriter = new PrintWriter(file1,"utf-8");
        for (Object o : set) {
            printWriter.println(o.toString());
        }
        printWriter.flush();
        printWriter.close();
    }
}
